home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / bsd / sparc / psl.h < prev    next >
C/C++ Source or Header  |  1995-02-14  |  2KB  |  70 lines

  1. /*      @(#)psl.h 1.8 91/05/22 SMI      */
  2.  
  3. /*
  4.  * Copyright (c) 1986 by Sun Microsystems, Inc.
  5.  */
  6.  
  7. #ifndef _sparc_psl_h
  8. #define _sparc_psl_h
  9.  
  10. /*
  11.  * Definition of bits in the Sun-4 PSR (Processor Status Register)
  12.  *  ________________________________________________________________________
  13.  * | IMPL | VER |      ICC      | resvd | EC | EF | PIL | S | PS | ET | CWP |
  14.  * |      |     | N | Z | V | C |       |    |    |     |   |    |    |     |
  15.  * |------|-----|---|---|---|---|-------|----|----|-----|---|----|----|-----|
  16.  *  31  28 27 24  23  22  21  20 19   14  13   12  11  8   7   6    5  4   0
  17.  *
  18.  * Reserved bits are defined to be initialized to zero and must
  19.  * be preserved if written, for compatibility with future revisions.
  20.  */
  21.  
  22. #define PSR_CWP        0x0000001F    /* current window pointer */
  23. #define PSR_ET        0x00000020    /* enable traps */
  24. #define PSR_PS        0x00000040    /* previous supervisor mode */
  25. #define PSR_S        0x00000080    /* supervisor mode */
  26. #define PSR_PIL        0x00000F00    /* processor interrupt level */
  27. #define PSR_EF        0x00001000    /* enable floating point unit */
  28. #define PSR_EC        0x00002000    /* enable coprocessor */
  29. #define PSR_RSV        0x000FC000    /* reserved */
  30. #define PSR_ICC        0x00F00000    /* integer condition codes */
  31. #define PSR_C        0x00100000    /* carry bit */
  32. #define PSR_V        0x00200000    /* overflow bit */
  33. #define PSR_Z        0x00400000    /* zero bit */
  34. #define PSR_N        0x00800000    /* negative bit */
  35. #define PSR_VER        0x0F000000    /* mask version */
  36. #define PSR_IMPL    0xF0000000    /* implementation */
  37.  
  38. #define PSL_ALLCC    PSR_ICC        /* for portability */
  39. #define SR_SMODE    PSR_PS
  40.  
  41. /*
  42.  * Handy psr values.
  43.  */
  44. #define PSL_USER    (PSR_S)        /* initial user psr */
  45. #define PSL_USERMASK    (PSR_ICC)    /* user variable psr bits */
  46. #define PSR_PIL1    0x100        /* for rounding up interrupt pri */
  47.  
  48. /*
  49.  * Macros to decode psr.
  50.  */
  51. #define USERMODE(ps)    (((ps) & PSR_PS) == 0)
  52. #define BASEPRI(ps)    (((ps) & PSR_PIL) == 0)
  53.  
  54. /*
  55.  * Convert system interrupt priorities (0-7) into a psr for splx.
  56.  * In general, the processor priority (0-15) should be 2 times
  57.  * the system pririty.
  58.  */
  59. #define pritospl(n)    ((n) << 9)
  60.  
  61. /*
  62.  * Convert a hardware interrupt priority level (0-15) into a psr for splx.
  63.  * Also are macros to convert back.
  64.  */
  65. #define ipltospl(n)    (((n) & 0xf) << 8)
  66. #define spltoipl(n)    (((n) >> 8) & 0xf)
  67. #define spltopri(n)    ((((n) + (1 << 8)) >> 9) & 0xf)
  68.  
  69. #endif /*!_sparc_psl_h*/
  70.